<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script type="text/javascript" src="scripts/boot.js"></script>
</head>
<body style="border: 0px; margin: 0px; padding: 0px;width: 100%;height: 100%">
<div class="mini-toolbar" style="border-bottom:0;padding:0px;">
    <table style="width:100%;">
        <tr>
            <td>
				药品类别：
				<input id="medicine_sort" emptyText="请选择..." class="mini-treeselect" url="purchasing_power_medicine_sort.do" multiSelect="false"  valueFromSelect="true"
			        textField="name" showClose="true" oncloseclick="clearT" valueField="id" parentField="pid" allowInput="false" showRadioButton="true" showFolderCheckBox="false" popupWidth="200px;"/>
           		<a class="mini-button" iconCls="icon-search" onclick="search()">查询</a>
            </td>
        </tr>
    </table>           
</div>
<div class="mini-fit" >
<div id="container1" style="min-width: 310px; height: 100%;width: 100%;"></div>
</div>

<script type="text/javascript">
mini.parse();
var data = [];
var options = {
		chart: {
	        type: 'pie'
	    },
	    title: {
	        text: '购药类别年龄段分布图'
	    },
	    plotOptions: {
	        column: {
	            pointPadding: 0.2,
	            borderWidth: 0
	        }
	    },
	    series:[{	
	    	type: 'pie',
	        name: '年龄段人数'
	    }],
	    credits:{
	    	text:"",
	        href:"javascript:void(0);"
	    }
};
var medicineSortId = mini.get("medicine_sort");
$(document).ready(function(){
	view();
});
function search(){
	view();
}
function view(){
	data = [];
	var chart = $('#container1').highcharts(options);
	$.post("medical_type_age_view.do", {medicineSortId: medicineSortId.getValue()}, function(info){
        $.each(info,function(i,d){
       		data.push([i,d]);
        });
   		chart = new Highcharts.Chart(options);
   		chart.series[0].setData(data);
	}, "json");
}
function clearT(e){
	e.sender.setValue("");	
}
</script>
</body>
</html>